<?php
namespace App\Http\Controllers\EnterpriseAccount;

use App\Http\Controllers\BaseApiController;
use App\Services\EnterpriseAccount\EnterpriseAccountService;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;

/**
 * Created by PhpStorm.
 * User: 1
 * Date: 2019/2/19
 * Time: 16:42
 */
class EnterpriseAccountController extends BaseApiController
{
    private $service;

    public function __construct(EnterpriseAccountService $service)
    {
        //继承基类的构造方法
        parent::__construct();
        //依赖注入service
        $this->service=$service;
    }
    // 用户登入
    public function checkLogin(Request $request)
    {
        $rule=['phone' => 'required|size:11','password' => 'required|max:50'];
        if($error=$this->validate($rule,$request))
        {
            return $error;
        }
        //根据类型去查询
        $data=$request->post();

        return $this->service->UserLogin($data);
    }


}